package monitor

import "gitee.com/rw555/fdsmastergo/pkg/keypad"

type CommandType int

const (
	CommandTypeNone  CommandType = iota
	CommandTypeKey               // 按键命令
	CommandTypeEvent             // 事件命令
)

type CommandTypeEventName int

const (
	EventNameNone           CommandTypeEventName = iota
	EventNameDelayClosePump                      // 关闭泵
)

type KeyCommandData struct {
	Key            keypad.Key
	KeyConfirmType keypad.KeyConfirmType
}

type EventCommandData struct {
	EventName CommandTypeEventName
	Params    map[string]interface{}
}

type Command struct {
	Type CommandType
	Data interface{}
}

func NewKeyCommand(key keypad.Key, confirmType keypad.KeyConfirmType) Command {
	return Command{
		Type: CommandTypeKey,
		Data: KeyCommandData{
			Key:            key,
			KeyConfirmType: confirmType,
		},
	}
}

func NewEventCommand(params map[string]interface{}) Command {
	return Command{
		Type: CommandTypeEvent,
		Data: EventCommandData{
			Params: params,
		},
	}
}
